![]() |
PATH![]() |
![]() ![]() |
An object class definition describes the common features of objects that belong to the class. For example, all document objects created by the AppleWorks application have certain properties (such as a name property) and elements (such as a window element) in common. An application's dictionary describes the classes that the application supports. You can view an application's dictionary by dropping the application's icon on the Script Editor's icon, or by opening the application with the Script Editor's Open Dictionary command.
Table 5-1 shows a sample object class definition for a window object, excerpted from the Finder dictionary. The definition contains three types of information: the plural form for the class, its elements (none in this case), and its properties. Each property description includes the name, the class, and a description. A property description should also state whether the property is read only.
The components of an object class definition are described in the following sections:
For more information about how AppleScript works with application dictionaries, see Dictionaries. For additional examples of class definitions, see the value class definitions in Values and Constants.
Different applications can support the same class in different ways. Table 5-2 shows a window class definition excerpted from the AppleWorks application. The window class defined by AppleWorks uses the same plural form as the Finder's window class and shares some properties, such as name, bounds, and zoomed. However, the AppleWorks version has elements, such as panes, that the Finder does not, and there are several properties the two classes do not share.
Table 5-1 Window class definition from the Finder dictionary
As you would expect, these applications define window classes that support the different ways they work with windows. AppleWorks uses windows to let users enter and manipulate data in word processing documents, spreadsheet cells, database records, and so on. The Finder uses windows to display disks, folders, and files, and to let users manipulate these items. When you perform script operations on a window in one of these applications, you have access to most of the operations a user can perform and, in some cases, to capabilities that a user cannot perform with the program's user interface.
Table 5-2 Window class definition from the AppleWorks dictionary